<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>注册</title>
    </h:head>
    <h:body>
        <h:form id="form_id">
            <p:panel id="register_panel" header="注册">
                <h:panelGrid columns="3" cellpadding="5">
                   
                    <p:outputLabel value="姓名:" for="name"/>
                    <p:inputText value="#{register.name}" id="name" required="true">
                        <f:validateLength minimum="2" maximum="45"/>
                        <p:ajax event="change"/>
                    </p:inputText>
                    <p:message for="name" showSummary="true" id="prompt_name"/>
                    
                    
                    <p:outputLabel value="学号:" for="studentID"/>
                    <p:inputText value="#{register.studentID}" required="true" id="studentID" validator="#{register.validateID}">
                        <f:validateLength minimum="10" maximum="10"/>
                        <f:validateRegex pattern="^[0-9]*$"/>
                    </p:inputText>
                   <p:message for="studentID" showSummary="true" id="prompt_ID"/>
                 

                    <p:outputLabel value="密码:" for="pw_1"/>
                    <p:password value="#{register.password}" required="true" id="pw_1">
                            <f:validateLength minimum="6" maximum="16" />
                            <p:ajax event="change"/>
                    </p:password>
                    <h:message for="pw_1"/>
                    
                    
                    <p:outputLabel value="再次确认:" for="pw_2"/>
                    <p:password required="true" id="pw_2" validator="#{register.validatePW}">
                        <p:ajax event="change" update="prompt_pw"/>      
                    </p:password>
                    <p:message for="pw_2" id='prompt_pw' showSummary="true"/>
                    
                    
                    <p:commandButton  id="validate_id" action="/ok.xhtml" value="注册" actionListener="#{register.inputNameID}" update="prompt_name prompt_ID prompt_btu">
                        <f:param  name="type" value="register"/>
                    </p:commandButton>
                    <p:message for="validate_id" id="prompt_btu" showSummary="true"/>
                
                </h:panelGrid>           
            </p:panel>         
        </h:form> 
    </h:body>
</html>

